<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="author" content="" />
<link rel="stylesheet" href="../css/main.css" type="text/css" />
<script type="text/javascript" src="../js/prototype.js"></script>
<script type="text/javascript" src="../js/scriptaculous.js"></script>
<script type="text/javascript" src="../js/controls.js"></script>
<script type="text/javascript" src="../js/page.js"></script>
<script type="text/javascript">
function crea_viste(){
	var url = "<?php print $_SESSION['__config__']['root_site'] ?>admin/crea_viste.php";
	
    req = new Ajax.Request(url,
			  {
			    	method:'post',
			    	parameters: $('views_form').serialize(true),
			    	onSuccess: function(transport){
			    		var response = transport.responseText || "no response text";
			    		//alert(response);
			    		dati = response.split(";");
			    		if(dati[0] == "ko"){
			    			alert("Errore SQL. \nQuery: "+dati[1]+"\nErrore: "+dati[2]);
			    			return;
			    		}
			    		else{
							alert("Operazione conclusa con successo");
			    		}
			    	},
			    	onFailure: function(){ alert("Si e' verificato un errore...") }
			  });
}
</script>
<title>Registro elettronico</title>
</head>
<body>
    <div id="header">
		<div class="wrap">
			<?php include "header.php" ?>
		</div>
	</div>
	<div class="wrap">
	<div id="main" style="background-color: #FFFFFF; padding-bottom: 30px; width: 100%">
    <form action="crea_viste.php" method="post" id="views_form">
        <table class="admin_table">
            <tr class="admin_title_row">
                <td style="font-weight: bold" colspan="2">Creazione viste statistiche</td>
            </tr>
            <tr class="admin_row">
                <td style="width: 30%; height: 40px">Anno scolastico</td>
                <td style="color: #003366; height: 40px">
                	<select name="anno" style="width: 400px; font-size: 11px;">
                    <?php 
                    while($s = $res_anni->fetch_assoc()){
                    ?>
                    	<option value="<?php print($s['id_anno']) ?>">A. S. <?php print $s['descrizione'] ?></option>
                    <?php 
                    }
                    ?>
                    </select>
                </td>
            </tr>
            <tr class="admin_row">
                <td style="width: 30%; height: 40px">Periodo </td>
                <td style="color: #003366; height: 40px">
                    <select name="quad" style="width: 400px; font-size: 11px;">
                    	<option value="0">Primo e secondo quadrimestre</option>
                    	<option value="1">Primo quadrimestre</option>
                    	<option value="2">Secondo quadrimestre</option>
                    </select>
                </td>
            </tr>
            <tr class="admin_row">
                <td colspan="2"></td>
            </tr>
            <tr class="admin_row_menu">
                <td colspan="2" style="text-align: right; padding-right: 50px">
                	<a href="#" onclick="crea_viste()" class="nav_link_first">Crea viste</a>|
                    <a href="index.php" class="nav_link_last">Torna al menu</a>
                </td>
            </tr>
            <tr class="admin_row">
                <td colspan="2"></td>
            </tr>
        </table>
        </form>
    </div>	
	<div id="footer">
		<p>Design: Luka Cvrk - <a href="http://www.solucija.com" title="Free Web Templates">Solucija</a></p>
	</div>
	</div>		
</body>
</html>